package com.bauer.java.sharding.base;

import org.apache.commons.dbcp.BasicDataSource;

import javax.sql.DataSource;

public class DataSourceFactory {

    public static DataSource createDataSource(final String dbName,String host) {
        BasicDataSource dataSource1 = new BasicDataSource();
        dataSource1.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource1.setUrl("jdbc:mysql://"+host+":3306/"+dbName);
        dataSource1.setUsername("root");
        dataSource1.setPassword("123456");
        return dataSource1;
    }
}
